<template>
  <div class="page">
    <goods v-for="(item, index) in list" :key="index" :item="item" @click="goods"></goods>
  </div>
</template>

<script>
import Goods from '@/components/Goods.vue'
import { productList ,queryProductListByCondition} from '@/api'
import mixin from '@/mixin'
export default {
  name: 'goods-list',
  mixins: [mixin],
  components: {
    Goods
  },
  data() {
    return {
      list: []
    }
  },
  created() {
    this.getData()
  },
  methods: {
    getData() {
      let params = {};
      params.className = this.$route.params.className;
      queryProductListByCondition(params).then(res => {
      //productList(params).then(res => {
        console.log(666);
        console.log(res);
        this.list = res
        console.log(666)
      })
    },
    goods(item) {
      this.$router.push(`/goods-detail/${item.productID}`)
    },
    onSearch() {

    }
  }
}
</script>
<style scoped lang="stylus" rel="stylesheet/stylus">
@import '../style/mixin'
</style>
